//
//  ContactTableViewCell.m
//  17--WeekendHomeWork
//
//  Created by 冀永金 on 16/8/5.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "ContactTableViewCell.h"
#import "Contact.h"
@implementation ContactTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self ctreateSubViews];
    }
    return self;
}
- (void)ctreateSubViews {
    self.image = [[UIImageView alloc]init];
    [self.contentView addSubview:_image];
    _nameLabel = [[UILabel alloc]init];
    [self.contentView addSubview:_nameLabel];
    _phonumLabel = [[UILabel alloc]init];
    [self.contentView addSubview:_phonumLabel];
    
    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.image.frame = CGRectMake(5, 5, (self.contentView.bounds.size.height - 10) * 4 / 3, self.contentView.bounds.size.height - 10);
    //self.image.image = [UIImage imageNamed:@"20140828015833_3xCLc.thumb.224_0"];
    _image.backgroundColor = [UIColor redColor];
    self.nameLabel.frame = CGRectMake((self.contentView.bounds.size.height - 10) * 4 / 3 + 10, 5, 200, 40);
    _nameLabel.backgroundColor = [UIColor yellowColor];
    self.phonumLabel.frame = CGRectMake((self.contentView.bounds.size.height - 10) * 4 / 3 + 10, 50, 200, 40);
    _phonumLabel.backgroundColor = [UIColor blueColor];
    
}
- (void)setValuesWithContact:(Contact *)contact {
    self.nameLabel.text = contact.name;
    self.phonumLabel.text = contact.phoneNumber;
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
